$("#hearder").on("click","img",function(){
	history.go(-1)
})
var keyword=getUrlParam("keyword");
var type=getUrlParam("type")
search(keyword,type)
function search(keyword,type)
{
	var data={};
	data['keyword']=keyword;
	data['type']=type;
	$.ajax({
    	type:"post",
    	url:Url+"orderSearch",
    	data:data,
    	async:false,
    	beforeSend: function () {
    		showDiv()
		},
    	success: function(data){
           hiddenDiv()	
           console.log(data);
           if(data.counts==0){
           		$(".discount-main-no").show()
           }else{
           		$(".discount-main-no").hide()
           }
           var str='';
           	for(var i=0;i<data.pagingData.length;i++){
           		var msg='';
           		var str1='';
           		        if (data.pagingData[i].order_states == 1) {
                            msg = '待付款';
                            if(data.pagingData[i].recording==null){
                        		str1= '<div class="op-remind">提醒客户付款</div>';
                        	}else{
                        		str1= '<div class="op-remind-out">提醒客户付款</div>';
                        	}
                            
                        } else if (data.pagingData[i].order_states == 2) {
                            msg = '待发货';
                            
                        } else if (data.pagingData[i].order_states == 3) {
                            msg = '已发货';
                           	str1= '<a href="logisticsInformation.html?id='+data.pagingData[i].order_id+'" class="op-remind">查看物流</a>';
                        }
                        else if (data.pagingData[i].order_states == 5) {
                            msg = '已取消';                           
                        }
                        else if (data.pagingData[i].order_states == 6) {
                            msg = '待评价';
                            str1= '<a href="logisticsInformation.html?id='+data.pagingData[i].order_id+'" class="op-remind">查看物流</a>';
                            
                        } else if (data.pagingData[i].order_states == 7) {
                            msg = '已完成';
                            str1= '<a href="logisticsInformation.html?id='+data.pagingData[i].order_id+'" class="op-remind">查看物流</a>';
                        }                      
		        str+='<div class="order-main">'   
				    	+'<a href="orderDetails.html?id='+data.pagingData[i].order_id+'">'
				    		+'<div class="order-num clear"><span class="order-num-l">订单编号：'+data.pagingData[i].order_number+'</span><span  class="order-num-r">订单状态：'+msg+'</span></div>'
					        +'<div class="order-num clear"><span class="order-num-l">订单时间：'+timestampToTime(data.pagingData[i].createtime)+'</span><span  class="order-num-r">用户名称：'+data.pagingData[i].nickname+'</span></div>'
					        +'<div class="order-details clear">'
					            +'<img class="od-img" src="'+data.pagingData[i].snap_img+'"></img>'
					            +'<div class="od-mian" >'
					                +'<span>'+data.pagingData[i].snap_name+'</span>'
					            +'</div>'
					            +'<div class="od-state" >'
					                +'<span>×'+data.pagingData[i].total_count+'</span>'
					            +'</div>'
					        +'</div>'
					        +'<div class="order-price clear">'
					            +'<div class="op-price">合计：'+data.pagingData[i].total_price+'</div>'	            
					            +'<a href="chat.html?id='+data.pagingData[i].user_id+'" class="op-ready">联系客户</a>'	
					            +str1
					        +'</div>'
				    	+'</a>'			        
				    +'</div>'
			    }        
		$("#order-main-list").html(str)
        },
    	complete: function () {
			
		}	
    });
}